

package com.hazelcast.jet;

import com.hazelcast.jet.config.JobConfig;
import com.hazelcast.jet.core.Processor;
import com.hazelcast.jet.core.ProcessorMetaSupplier;
import com.hazelcast.jet.core.ProcessorSupplier;

import java.io.Serial;

/**
 * Exception to throw from job-executing methods to indicate a failure that can
 * be resolved by restarting the job.
 * <p>
 * It is handled when thrown from:<ul>
 * <li>{@link Processor} methods
 * <li>lambda functions: key & timestamp extractors, map functions...
 * <li>sources/sinks
 * <li>{@code init()} method in {@link Processor}, {@link
 * ProcessorSupplier} and {@link ProcessorMetaSupplier} (but not their
 * {@code close()} methods)
 * <li>...
 * </ul>
 * <p>
 * If this exception is caught, the job will be terminated abruptly and
 * restarted (if {@link JobConfig#setAutoScaling so configured}).
 *
 * @since Jet 3.0
 */
public class RestartableException extends JetException {

    @Serial
    private static final long serialVersionUID = 1L;

    public RestartableException() {
    }

    public RestartableException(String message) {
        super(message);
    }

    public RestartableException(String message, Throwable cause) {
        super(message, cause);
    }

    public RestartableException(Throwable cause) {
        super(cause);
    }

}
